<h2 class="title">Consultar <?php echo $MODEL->label; ?></h2>

<?php 
echo $this->element('filtros/filtros');
echo $this->element('filtros/activos');
?>

<table>
    <tr>
        <?php echo $this->element('head'); ?>
        <th>Acciones</th>
    </tr>

    <?php foreach ($rows as $row): ?>
        <tr>

            <?php
            foreach ($cols as $col) {                
                list($tabla, $campo) = explode(".", $col["name"]);         
                $settings = array("data" => $col, "value" => $row[$tabla][$campo], "html" => false);
                echo '<td>' . $this->Presentation->getContent("renderReadOnly", $settings) . '</td>';
            }
            ?>

            <td class="acciones">
                <?php 
                if (in_array("V", array_keys($actions))) {
                    echo $this->Form->postLink($this->Html->image('lupa.gif', array("alt" => "Visualizar")), array('action' => $actions['V'], $row[$MODEL->name][$MODEL->primaryKey]), array('escape' => false, 'data' => createPostData()));
                }
                if (in_array("E", array_keys($actions)) && $CONTROLLER->tienePermiso($this->request->params['controller'], 'edit')) {
                    echo $this->Form->postLink($this->Html->image('edit.gif', array("alt" => "Editar")), array('action' => $actions['E'], $row[$MODEL->name][$MODEL->primaryKey]), array('escape' => false, 'data' => createPostData())); 
                }
                if (in_array("D", array_keys($actions)) && $CONTROLLER->tienePermiso($this->request->params['controller'], 'delete')) {
                    echo $this->Form->postLink($this->Html->image('delete.png', array("alt" => "Eliminar")), array('action' => $actions['D'], $row[$MODEL->name][$MODEL->primaryKey]), array('confirm' => '¿Estás seguro de borrar el registro?', 'escape' => false)); 
                }
                ?>
            </td>
        </tr>
    <?php endforeach; ?>
</table>

<?php
echo $this->element('paginador');
?>